package com.wondertek.poms.dao.repo;

import com.wondertek.poms.dao.po.PlanMovePrdInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * @author evan0213
 * @description
 */
@Repository
public interface IPlanMovePrdInfoDao extends JpaRepository<PlanMovePrdInfo, Long>, JpaSpecificationExecutor<PlanMovePrdInfo> {

	@Modifying
	@Query(value = "update PLAN_MOVE_PRD_INFO set STATUS = 4 where ID=?1", nativeQuery = true)
	int offLine(Long id);

	@Query(value = "select * from PLAN_MOVE_PRD_INFO where STATUS=?1 and PLAN_TIME<=?2", nativeQuery = true)
	List<PlanMovePrdInfo> findAllByStatus(String status, Date date);
}
